package xin.ham.aprs4gserv.entity;

import cn.hutool.json.JSONObject;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;

@Slf4j
@Data
@TableName("aprs_dev")
public class Aprs4GConf {

    @TableId("imei")
    private String imei;
    @TableField("devtype")
    private String devtype;
    @TableField("version")
    private String version;
    @TableField("curdate")
    private String curdate;
    @TableField("callsign")
    private String callsign;
    @TableField("passcode")
    private Integer passcode;
    @TableField("ssid")
    private String ssid;
    @TableField("serverip")
    private String serverip;
    @TableField("serverport")
    private Integer serverport;
    @TableField("aprstable")
    private String aprstable;
    @TableField("aprssymbol")
    private String aprssymbol;
    @TableField("beacon")
    private String beacon;
    @TableField("beaconinterval")
    private Integer beaconinterval;
    @TableField("beaconstatusinterval")
    private Integer beaconstatusinterval;
    @TableField("trackermode")
    private Integer trackermode;
    @TableField("fixloclat")
    private Double fixloclat;
    @TableField("fixloclng")
    private Double fixloclng;
    @TableField("locmode")
    private Integer locmode;
    @TableField("traccarhost")
    private String traccarhost;
    @TableField("plat")
    private Integer plat;
    @TableField("webcmdhost")
    private String webcmdhost;
    @TableField("maxdecay")
    private Integer maxdecay;
    @TableField("trickmode")
    private Integer trickmode;
    @TableField("travelmode")
    private Integer travelmode;
    @TableField("displayver")
    private Integer displayver;
    @TableField("beacontext")
    private String beacontext;

    @TableField("agnssenable")
    private Integer agnssenable;
    @TableField("audioenable")
    private Integer audioenable;
    @TableField("powersavemode")
    private Integer powersavemode;
    @TableField("powersavemodetime")
    private Integer powersavemodetime;
    @TableField("powersavemoded1time")
    private Integer powersavemoded1time;
    @TableField("powersavemoded2time")
    private Integer powersavemoded2time;
    @TableField("smscatenable")
    private Integer smscatenable;
    @TableField("smscatmobile")
    private String smscatmobile;
    @TableField("totalmileage")
    private Double totalmileage;
    @TableField("shicitype")
    private String shicitype;
    @TableField("talkmode")
    private Integer talkmode;
    @TableField("talkchannel")
    private String talkchannel;
    @TableField("btnmode")
    private Integer btnmode;

    public JSONObject toClientConf(){
        JSONObject rs = new JSONObject();
        rs.set("IMEI", this.imei);
        rs.set("DEV_TYPE", this.devtype);
        rs.set("CALLSIGN", this.callsign);
        rs.set("PASSCODE", this.passcode);
        rs.set("SSID", this.ssid);
        rs.set("SERVER", this.serverip);
        rs.set("PORT", this.serverport);
        rs.set("TABLE", this.aprstable);
        rs.set("SYMBOL", this.aprssymbol);
        rs.set("BEACON", this.beacon);
        rs.set("BEACON_INTERVAL", this.beaconinterval);
        rs.set("BEACON_STATUS_INTERVAL", this.beaconstatusinterval);
        rs.set("TRACKERMODE", this.trackermode);
        rs.set("FIXLOC_LAT", this.fixloclat);
        rs.set("FIXLOC_LNG", this.fixloclng);
        rs.set("LOCMODE", this.locmode);
        rs.set("TRACCAR_HOST", this.traccarhost);
        rs.set("PLAT", this.plat);
        rs.set("WEBCMD_HOST", this.webcmdhost);
        rs.set("MAX_DECAY", this.maxdecay);
        rs.set("TRICK_MODE", this.trickmode);
        rs.set("TRAVEL_MODE", this.travelmode);
        rs.set("DISPLAY_VER", this.displayver);
        rs.set("BEACON_TEXT", this.beacontext);

        rs.set("AGNSS_ENABLE", this.agnssenable);
        rs.set("AUDIO_ENABLE", this.audioenable);
        rs.set("POWER_SAVE_MODE", this.powersavemode);
        rs.set("POWER_SAVE_MODE_TIME", this.powersavemodetime);
        rs.set("POWER_SAVE_MODE_D1TIME", this.powersavemoded1time);
        rs.set("POWER_SAVE_MODE_D2TIME", this.powersavemoded2time);
        rs.set("SMS_CAT_ENABLE", this.smscatenable);
        rs.set("SMS_CAT_MOBILE", this.smscatmobile);

        rs.set("TOTAL_MILEAGE", this.totalmileage);
        rs.set("SHICI_TYPE", this.shicitype);

        rs.set("TALK_MODE", this.talkmode);
        rs.set("TALK_CHANNEL", this.talkchannel);
        rs.set("BTN_MODE", this.btnmode);
        return rs;
    }

}
